package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.entity.ReturnVo;
import com.example.mapper.StudentMapper;
import com.example.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @Auther:
 * @Date: 2021/11/20 17:24
 * @Description:
 */
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public List<ReturnVo> selectById(Integer id) {
        List<ReturnVo> vo = studentMapper.selectVo(null);
        System.out.println(vo);
        return vo;
    }

    @Override
    public List<ReturnVo> selectByName(String name) {
        return studentMapper.selectNameVo(name);
    }

    @Override
    public List<ReturnVo> selectPageByName(String name) {

        HashMap<Object, Object> map = new HashMap<>();
//        map.put("name", "小明");
        map.put("page", 1);
        map.put("limit", 2);
        List<ReturnVo> vos = studentMapper.selectMapVo(map);
        return vos;
    }

    @Override
    public List<ReturnVo> selectPageByVo(ReturnVo vo) {
        return studentMapper.selectPageVo(vo);
    }
}
